//////https://ac.nowcoder.com/acm/problem/226516
////
////#include<iostream>
////#include<cstring>
////using namespace std;
////
////const int N = 1010;
////int v[N], w[N], dp[N][N];
////
////int main()
////{
////	int n, m; cin >> n >> m;
////	for (int i = 1; i <= n; i++)
////		cin >> v[i] >> w[i];
////	for (int i = 1; i <= n; i++)
////	{
////		for (int j = 0; j <= m; j++)
////		{
////			dp[i][j] = dp[i - 1][j];
////			if (j >= v[i])
////				dp[i][j] = max(dp[i][j], dp[i][j - v[i]] + w[i]);
////		}
////	}
////	cout << dp[n][m] << endl;
////	memset(dp, -0x3f3f3f3f, sizeof dp);
////	dp[0][0] = 0;
////	for (int i = 1; i <= n; i++)
////	{
////		for (int j = 0; j <= m; j++)
////		{
////			dp[i][j] = dp[i - 1][j];
////			if (j >= v[i])
////				dp[i][j] = max(dp[i][j], dp[i][j - v[i]] + w[i]);
////		}
////	}
////	if (dp[n][m] > 0)cout << dp[n][m] << endl;
////	else cout << 0 << endl;
////	return 0;
////}
//
//#include<iostream>
//#include<cstring>
//using namespace std;
//
//const int N = 1010;
//int v[N], w[N], dp[N];
//
//int main()
//{
//	int n, m; cin >> n >> m;
//	for (int i = 1; i <= n; i++)
//		cin >> v[i] >> w[i];
//
//	for (int i = 1; i <= n; i++)
//		for (int j = v[i]; j <= m; j++)
//			dp[j] = max(dp[j], dp[j - v[i]] + w[i]);
//	cout << dp[m] << endl;
//
//	memset(dp, -0x3f3f3f3f, sizeof dp);
//	dp[0] = 0;
//	for (int i = 1; i <= n; i++)
//		for (int j = v[i]; j <= m; j++)
//			dp[j] = max(dp[j], dp[j - v[i]] + w[i]);
//	if (dp[m] > 0)cout << dp[m] << endl;
//	else cout << 0 << endl;
//	return 0;
//}